import { _decorator, Label } from "cc";
import { regView, BaseView } from "../../../../../extensions/cocos-scaffold-3x/assets/ui/base/BaseView";
import { ViewJoker } from "../../ViewJoker";
import { JC } from "../../m/JokerStorage";

const { ccclass, property } = _decorator;


export class ViewFinishJokerStageProp {
    constructor(
        public viewJoker: ViewJoker,
        public stageInfo: JC.PokerGameStage
    ) { }
}

@regView({
    bundle: "subBundle",
    prefabPath: "joker/v/finishJokerStage/ViewFinishJokerStage"
}) @ccclass('ViewJoker')
export class ViewFinishJokerStage extends BaseView<ViewFinishJokerStageProp> {

    @property(Label)
    lbScore: Label = null


    @property(Label)
    lbTargetNum: Label = null


    @property(Label)
    lbLevel: Label = null

    onOpen() {
        this.lbLevel.string = `第${this.prop.stageInfo.index + 1}关完成`
        this.lbScore.string = `${this.prop.stageInfo.score}`
        this.lbTargetNum.string = `${this.prop.stageInfo.targetNum}`

    }

    onTouchContitnue() {
        this.prop.viewJoker.startNextStage()
        this.close()
    }

}
